package com.hsnn.medstgmini.base.std.controller;

import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.OutputStream;
import java.lang.reflect.Type;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.hsnn.medstgmini.Constants;
import com.hsnn.medstgmini.base.dict.dao.impl.DicAreaDaoImpl;
import com.hsnn.medstgmini.base.dict.model.DicArea;
import com.hsnn.medstgmini.base.dict.model.DicCompType;
import com.hsnn.medstgmini.base.dict.model.form.DicAreaForm;
import com.hsnn.medstgmini.base.dict.service.DicAreaManager;
import com.hsnn.medstgmini.base.dict.service.DicCompTypeManager;
import com.hsnn.medstgmini.base.std.model.StdCompgroup;
import com.hsnn.medstgmini.base.std.model.StdCompinfo;
import com.hsnn.medstgmini.base.std.model.StdCompinfoDetail;
import com.hsnn.medstgmini.base.std.model.StdCompinfoLog;
import com.hsnn.medstgmini.base.std.service.StdCompinfoDetailManager;
import com.hsnn.medstgmini.base.std.service.StdCompinfoLogManager;
import com.hsnn.medstgmini.base.std.service.StdCompinfoManager;
import com.hsnn.medstgmini.exception.MSException;
import com.hsnn.medstgmini.pro.base.service.BaseCompService;
import com.hsnn.medstgmini.sys.model.SysUser;
import com.hsnn.medstgmini.util.AccountUtil;
import com.hsnn.medstgmini.util.AreaUtil;
import com.hsnn.medstgmini.util.ExcelUtil;
import com.hsnn.medstgmini.util.Pagination;
import com.hsnn.medstgmini.util.PinYin;

/**
 * 企业库 CONTROLLER
 * 
 * @author hss@njhsnn 2015年6月9日
 */
@Controller
@RequestMapping("/stdCompinfo")
public class StdCompinfoController {
	private static final Logger log = Logger.getLogger(StdCompinfoController.class);
	@Autowired
	private StdCompinfoManager stdCompinfoManager;

	@Autowired
	private StdCompinfoDetailManager stdCompinfoDetailManager;

	@Autowired
	private StdCompinfoLogManager stdCompinfoLogManager;

	@Autowired
	private DicAreaManager DicAreaManager;
	
	@Autowired
	private DicAreaDaoImpl dicAreaDaoImpl;

	@Autowired
	private DicCompTypeManager dicCompTypeManager;
	
	@Autowired
	private HttpServletRequest request;
	
	@Autowired
	private BaseCompService compService;
	/**
	 * @category 获取stdCompInfo信息
	 * @param 
	 * @return  SysUser
	 */
	public SysUser getUser(){
		return (SysUser) request.getSession().getAttribute(Constants.USERINFO);
	}
	
/*	@Value("${list.get(0).areaId}")
	private String areaId;*/

	/**
	 * 跳转到JSP页面
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping("/stdCompinfoListJsp")
	public String stdCompinfoListJsp(Model model) {
		return "/base/std/compList";
	}

	/**
	 * 跳转到新增页面
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/stdCompinfoAddJsp")
	public String stdCompinfoAddJsp(HttpServletRequest request) {
		return "/base/std/compAdd";
	}

	/**
	 * 跳转到修改页面
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/stdCompinfoEditJsp")
	public String stdCompinfoEditJsp(HttpServletRequest request) {
		printParams();
		try {
			
			String compId = request.getParameter("compId");
			if (StringUtils.isNotEmpty(compId)) {
				List<StdCompinfo> list = stdCompinfoManager.queryStdCompinfoById(compId);
				request.setAttribute("list", list);
				DicAreaForm dicArea = DicAreaManager.getDicAreaById(list.get(0).getAreaId());
				if(dicArea!=null){
					request.setAttribute("areaName", dicArea.getAreaName());
					request.setAttribute("areaId", dicArea.getAreaId());
				}
				if(StringUtils.isNotBlank(list.get(0).getAreaId())){
					if("0000".equals(list.get(0).getAreaId().substring(2, 6))){
						DicArea area = dicAreaDaoImpl.getDicAreaById(list.get(0).getAreaId());
						if(area!=null){
							request.setAttribute("areaId1", area.getAreaid());
							request.setAttribute("areaName1", area.getAreaname());
						}
					}else if("00".equals(list.get(0).getAreaId().substring(4, 6))){
						DicArea area2 = dicAreaDaoImpl.getDicAreaById(list.get(0).getAreaId());
						StringBuffer sb = new StringBuffer(list.get(0).getAreaId().substring(0, 2));
						DicArea area1 = dicAreaDaoImpl.getDicAreaById(sb.append("0000").toString());
						if(area1!=null){
							request.setAttribute("areaId2", area2.getAreaid());
							request.setAttribute("areaName2", area2.getAreaname());
							request.setAttribute("areaId1", area1.getAreaid());
							request.setAttribute("areaName1", area1.getAreaname());
						}
					}else{
						DicArea area3 = dicAreaDaoImpl.getDicAreaById(list.get(0).getAreaId());
						StringBuffer sb1 = new StringBuffer(list.get(0).getAreaId().substring(0, 4));
						DicArea area2 = dicAreaDaoImpl.getDicAreaById(sb1.append("00").toString());
						StringBuffer sb2 = new StringBuffer(list.get(0).getAreaId().substring(0, 2));
						DicArea area1 = dicAreaDaoImpl.getDicAreaById(sb2.append("0000").toString());
						if(area1!=null){
							request.setAttribute("areaId3", area3.getAreaid());
							request.setAttribute("areaName3", area3.getAreaname());
							request.setAttribute("areaId2", area2.getAreaid());
							request.setAttribute("areaName2", area2.getAreaname());
							request.setAttribute("areaId1", area1.getAreaid());
							request.setAttribute("areaName1", area1.getAreaname());
						}
					}
				}
				DicCompType compreg = stdCompinfoManager.getDicCompRegId(list.get(0).getCompRegId());
				if(compreg!=null){
					if("0".equals(compreg.getFatherId())){
						request.setAttribute("compRegId1", compreg.getCompRegId());
						request.setAttribute("compRegName1", compreg.getCompRegName());
					}else {
						DicCompType compreg1 = stdCompinfoManager.getDicCompRegId(compreg.getFatherId());
						request.setAttribute("compRegId1", compreg1.getCompRegId());
						request.setAttribute("compRegName1", compreg1.getCompRegName());
						request.setAttribute("compRegId2", compreg.getCompRegId());
						request.setAttribute("compRegName2", compreg.getCompRegName());
					}
				}
				
				return "/base/std/compEdit";
			} else {
				return "/base/std/compList";
			}
		} catch (Exception e) {
			e.printStackTrace();
			log.info("跳转到修改页面异常");
			return "/base/std/compList";
		}

	}

	/**
	 * 企业库信息增加和修改
	 * 
	 * @param request
	 */
	@RequestMapping(value = "/stdCompinfoAdd")
	@ResponseBody
	public Pagination stdCompinfoAdd(StdCompinfo stdCompInfo,DicArea dicArea,StdCompinfoDetail stdDetail,DicCompType dicCompType,StdCompgroup stdCompgroup) {
		printParams();
		Pagination page = new Pagination();
		try {
			SysUser user = (SysUser) request.getSession().getAttribute(Constants.USERINFO);
			if (stdCompInfo != null) {
				Map<String, Object> map = stdCompinfoManager.getCompinfoByCode(stdCompInfo.getCompCode());
				if(StringUtils.isNotBlank(stdCompInfo.getCompCode())){
					//编辑
					if(stdCompinfoManager.checkRepeat("comp_name", stdCompInfo.getCompName(), stdCompInfo.getCompId(),stdCompInfo.getCompType())>0){
						page.setSuccess(false);
						page.setMsg("该名称已存在！");
						return page;
					}
				}else{
					//新增
					if(stdCompinfoManager.checkRepeat("comp_name", stdCompInfo.getCompName(), "",stdCompInfo.getCompType())>0){
						page.setSuccess(false);
						page.setMsg("该名称已存在！");
						return page;
					}
					//新增时自动生成编码
					if(stdCompInfo.getCompType()==Constants.STD_COMPINFO_COMPTYPE_SC_LEN){
						stdCompInfo.setCompCode(AccountUtil.getStdSequence(Constants.STD_QIYE_SC_PREFIX,Constants.STD_QIYE_SC,Constants.STD_QIYE_SC_LEN));
					}else if(stdCompInfo.getCompType()==Constants.STD_COMPINFO_COMPTYPE_PS_LEN){
						stdCompInfo.setCompCode(AccountUtil.getStdSequence(Constants.STD_QIYE_PS_PREFIX, Constants.STD_QIYE_PS, Constants.STD_QIYE_PS_LEN));
					}
				}
				stdDetail.setUpdUser(user.getId());
				stdDetail.setUpdDatetime(new Date());
				stdCompInfo.setUpdUser(user.getId());

				stdCompInfo.setStdCompinfoDetail(stdDetail);
				stdCompInfo.setDicArea(dicArea);
				stdCompInfo.setDicCompType(dicCompType);
				stdCompInfo.setStdCompgroup(stdCompgroup);
				stdCompInfo.setUpdDatetime(Timestamp.valueOf(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())));
				if(StringUtils.isBlank(stdCompInfo.getCompId())){
					stdCompInfo.setStatus(Short.valueOf("1"));
					stdCompInfo.setMergeState(Short.valueOf("0"));
				}
				if (null!= map && !stdCompInfo.getCompName().equals(map.get("comp_name").toString())){
					stdCompInfo.setCompSpelCode(PinYin.getPinYinHeadChar(stdCompInfo.getCompName()));
				}
				stdCompinfoManager.addAndEdit(stdCompInfo);
				
				if ((null!= map) && (!stdCompInfo.getCompName().equals(map.get("comp_name").toString()) || !stdCompInfo.getCompShortName().equals(map.get("comp_short_name").toString()))){
					CheckCompThread th = new CheckCompThread( compService, stdCompInfo);
					th.start();
				}
				
				page.setMsg(stdCompInfo.getCompCode());
				page.setSuccess(true);
			}
		} catch (MSException e) {
			log.error("",e);
			page.setSuccess(false);
			page.setMsg(e.getMsg());
		} catch (Exception e) {
			log.error("",e);
			page.setSuccess(false);
			page.setMsg("保存失败！");
		}
		return page;
		
	}
	

	/**
	 * 企业库 查询及条件查询
	 * 
	 * 用来封装json
	 * 
	 * @param request
	 * @param result
	 * @return
	 */
	@RequestMapping("/stdCompinfoList")
	@ResponseBody
	public Pagination getStdCompinfoList(StdCompinfo stdCompinfo) {
		printParams();
		Pagination page = new Pagination(request);
		try {
			page = stdCompinfoManager.queryStdCompinfoList(page, stdCompinfo);
			page.setSuccess(true);
		} catch (Exception e) {
			e.printStackTrace();
		} catch (Error error) {
			error.printStackTrace();
			page.setSuccess(false);
		}
		return page;
	}

	@RequestMapping("/stdCompinfoListAll")
	@ResponseBody
	public Pagination getStdCompinfoListAll(StdCompinfo stdCompinfo) {
		printParams();
		Pagination page = new Pagination(request);
		try {
			String area1 = request.getParameter("area1");
			String area2 = request.getParameter("area2");
			String area3 = request.getParameter("area3");
			String areaId = AreaUtil.getAreaStartCode(area1, area2, area3);
			if(StringUtils.isNotBlank(areaId)){
				stdCompinfo.setAreaId(areaId);
			}
			page = stdCompinfoManager.queryStdCompCount(page);
			page.setSuccess(true);
		} catch (Exception e) {
			e.printStackTrace();
		} catch (Error error) {
			error.printStackTrace();
			page.setSuccess(false);
		}
		return page;
	}
	
	

	@RequestMapping(value={"/enable","/disable","/batchChangeStatus"})
	@ResponseBody
	public Pagination batchChangeStatus(String array) {
		printParams();
		Pagination page = new Pagination();
		SysUser user = (SysUser) request.getSession().getAttribute(Constants.USERINFO);
		try {
			int sum = 0;
			if (array != null && !"".equals(array)) {
				Gson gson = new Gson();
				Type type = new TypeToken<List<StdCompinfo>>() {
				}.getType();
				List<StdCompinfo> list = gson.fromJson(array, type);
				if (list != null && list.size()>0) {
					for (StdCompinfo dds : list) {
						dds.setUpdUser(user.getId());
						int count = stdCompinfoManager.batchStarts(dds);
						sum += count;
					}
					page.getConditions().put("sum", sum+"");
					page.setSuccess(true);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			page.setSuccess(false);
		}
		return page;
	}
	

	/**
	 * 企业库 查询及条件查询
	 * 
	 * 用来封装json
	 * 
	 * @param request
	 * @param result
	 * @return
	 */
	@RequestMapping("/stdCompinfoLogList")
	@ResponseBody
	public Pagination getstdCompinfoLogList(HttpServletRequest request) {
		printParams();
		Pagination page = new Pagination(request);
		StdCompinfoLog stdCompinfoLog = new StdCompinfoLog();

		try {
			String compId = request.getParameter("compId");
			String date1 = request.getParameter("date1");
			String date2 = request.getParameter("date2");
			String status = request.getParameter("status");
			stdCompinfoLog.setCompId(compId);
			stdCompinfoLog.setCompCode(date1);
			stdCompinfoLog.setCompName(date2);
			if(StringUtils.isNotEmpty(status)){
				stdCompinfoLog.setStatus(Short.valueOf(status));
			}
			List<StdCompinfoLog> list = stdCompinfoManager
					.queryStdCompinfoLogByName(page, stdCompinfoLog);
			page.setRecords(list.size());
			page.setRows(list);
		} catch (Exception e) {
			e.printStackTrace();
		} catch (Error error) {
			error.printStackTrace();
		}
		return page;
	}

	/**
	 * 企业库详情页面 
	 * 
	 * @category author 韩守松
	 * @date 2015年6月12日
	 * @param @param request
	 * @param @return
	 */
	@RequestMapping(value = "/toStdCompinfoSeltDetailJsp")
	public String toStdCompinfoSeltDetailJsp(HttpServletRequest request,
			String compId) {
		printParams();
			StdCompinfo list =  stdCompinfoManager.queryStdCompInfoByCompId(compId);
			if(list.getDicCompType()!=null){
				if(StringUtils.isNotBlank(list.getDicCompType().getFatherId())){
					DicCompType compreg = stdCompinfoManager.getDicCompRegId(list.getDicCompType().getFatherId());
					list.getDicCompType().setFatherCompRegName(compreg.getCompRegName());
				}
			}
			request.setAttribute("list", list);
			return "/base/std/compSeltDetail";
		
	}
	/**
	 * 企业库详情页面 通过企业编码链接
	 * 
	 * @category author 韩守松
	 * @date 2015年6月12日
	 * @param @param request
	 * @param @return
	 */
	@RequestMapping(value = "/toStdCompinfoDetailJsp")
	public String toStdCompinfoDetailJsp(HttpServletRequest request,
			String compCodeDetail) {
		printParams();
			StdCompinfo	list = stdCompinfoManager.queryStdCompInfoByCompCode(compCodeDetail);
			request.setAttribute("list", list);
			return "/base/std/compDetail";
	}

	@RequestMapping(value = "/toStdCompinfoDetail")
	public String toStdCompinfoDetail(HttpServletRequest request, Pagination page, StdCompinfo stdCompinfo) {
		printParams();
		String compId = request.getParameter("compId");
		List<StdCompinfo> list = null;
		if (StringUtils.isNotBlank(compId)) {
			list = stdCompinfoManager.queryStdCompinfoById(compId);
		}
		request.setAttribute("list", list.get(0));
		return "/base/std/compDetail";
	}
	
	/**
	 * 
	 *@category 获取参数打印
	 *@author wangbing
	 *@date 2015年6月9日
	 *Pagination
	 */
	@SuppressWarnings("rawtypes")
	public void printParams(){
		Enumeration paramNames = request.getParameterNames();
		try {
			while (paramNames.hasMoreElements()) {
				String paramName = (String) paramNames.nextElement();
				String paramValue = request.getParameter(paramName);
				log.info(paramName+":"+paramValue);
			}
		} catch (Exception e) {
			log.error("",e);
		}
	}
	
	/**
	 * 
	 *@category 导出excel
	 *@author wangbing
	 *@date 2015年6月9日
	 *Pagination
	 */
	@RequestMapping("exportExcel")
	@ResponseBody
	public Pagination exportExcel(HttpServletResponse response,String fileName){
		printParams();
		Pagination page = new Pagination();
		String compCode = request.getParameter("compCode");
		String compName = request.getParameter("compName");
		String compType = request.getParameter("compType");
		String area1 = request.getParameter("area1");
		String area2 = request.getParameter("area2");
		String area3 = request.getParameter("area3");
		String compRegId = request.getParameter("compRegId2");
		if(StringUtils.isBlank(compRegId)){
			compRegId = request.getParameter("compRegId1");
		}
		String areaId = AreaUtil.getAreaStartCode(area1, area2, area3);
		String status = request.getParameter("status");
		if(StringUtils.isNotBlank(compCode)){
			page.getConditions().put("compCode", compCode.trim());
		}
		if(StringUtils.isNotBlank(compName)){
			page.getConditions().put("compName", compName.trim());
		}
		if(StringUtils.isNotBlank(compType)){
			page.getConditions().put("compType", compType.trim());
		}
		if(StringUtils.isNotBlank(compRegId)){
			page.getConditions().put("compRegId", compRegId.trim());
		}
		if(StringUtils.isNotBlank(areaId)){
			page.getConditions().put("areaId", areaId.trim());
		}
		if(StringUtils.isNotBlank(status)){
			page.getConditions().put("status", status.trim());
		}
		
		try {
			response.addHeader("Content-Disposition", "attachment;filename="+new String(fileName.getBytes("GB2312"),"iso8859-1")); 
			OutputStream os= new BufferedOutputStream(response.getOutputStream());  
			 response.setContentType("application/vnd.ms-excel;charset=utf-8");  
			 stdCompinfoManager.getStdCompinfoNoPage(page);
			 String title = "企业";
			 String[] headers = {"企业编码","企业名称","企业名称拼音码","企业英文名称","企业简称","简称拼音码","企业类型","地区","企业注册类型","组织机构代码","所属集团","机构电话","机构地址","企业分类","状态","注册资本","企业简介","营业范围","法人姓名","法人身份证号","法人电话","法人手机","联系人姓名","联系人身份证号","联系人职务","联系人电话","联系人手机","联系人邮箱","联系人QQ","营业执照编号","营业执照有效期始","营业执照有效期止","税务登记证号","经营许可证编号","经营许可证有效期始","经营许可证有效期止","企业法人营业执照号","企业法人营业执照号有效期始","企业法人营业执照号有效期止"};
			 String[] alias = {"compCode","compName","compSpelCode","compNameEng","compShortName","compShortSpelCode","compType","areaName","compRegName","orgCode","compGroupName","compPhone","compAddress","compClassify","status","regCap","compProfile","bizScope","legalRepName","legalRepIdnum","legalRepTelephone","legalRepHandphone","contactName","contactIdnum","contactPos","contactTelephone","contactHandphone","contactEmail","contactQq","bizLiceNo","bizLiceStartDate","bizLiceEndDate","taxCode","indusCode","indusCodeStartDate","indusCodeEndDate","legalRepCertCode","legalRepStartDate","legalRepEndDate"};
			 ExcelUtil.exportExcel(page, os, title, headers, alias);
		} catch (Exception e) {
			page.setSuccess(false);
			e.printStackTrace();
		}
		return page;
	}
	
	@RequestMapping(value = "/toCompInfoByCode")
	public String toStdCompinfoDetail(String compCode) {
		StdCompinfo list = stdCompinfoManager.getCompInfoByCode(compCode);
		request.setAttribute("list", list);
		return "/base/std/compDetail";
	}
	
	/**
	 * @category 根据企业名称或简拼搜索企业
	 * @date 2015年11月19日
	 * @param compName
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/searchCompByName")
	public Pagination searchCompByName(String compName) {
		Pagination page = new Pagination(request);
		if (StringUtils.isNotBlank(compName)) {
			page.getConditions().put("compName", compName);
			stdCompinfoManager.searchCompByName(page);
			page.setSuccess(true);
		}
		return page;
	}
	
}







class CheckCompThread extends Thread{
	private BaseCompService compService;
	private StdCompinfo stdCompInfo;
	public CheckCompThread( BaseCompService compService,StdCompinfo stdCompInfo){
		this.compService = compService;
		this.stdCompInfo = stdCompInfo;
	}
	public void run (){
		try {
			if(stdCompInfo.getCompType()==Constants.STD_COMPINFO_COMPTYPE_SC_LEN){
				compService.stdproddruginfo( stdCompInfo);
				/*compService.anahospitalprodcompdrug( stdCompInfo);
				compService.anahospitalprodcompdrugmon( stdCompInfo);
				compService.anahospitalprodcomp( stdCompInfo);
				compService.anahospitalprodcompmon( stdCompInfo);
				compService.anaprodcompinfoarea( stdCompInfo);
				compService.anaprodcompinfoareamon( stdCompInfo);
				compService.anaprodcompdruginfoarea( stdCompInfo);
				compService.anaprodcompdruginfoareamon( stdCompInfo);
				compService.anaproddruginfototal( stdCompInfo);
				compService.anaproddruginfototalmon( stdCompInfo);
				compService.anaprodcompinfosea( stdCompInfo);
				compService.anaprodcompinfoyear( stdCompInfo);
				compService.anaprodcompinfo( stdCompInfo);
				compService.anaprodcompinfomon( stdCompInfo);*/
				//没找到的表
				/*compService.purorderinfo( stdCompInfo);*/
				compService.basegoodsitem( stdCompInfo);
				compService.sysUser( stdCompInfo);
				
			}else if(stdCompInfo.getCompType()==Constants.STD_COMPINFO_COMPTYPE_PS_LEN){
				/*compService.puraoginfoDel( stdCompInfo);
				compService.anacomplprodcompareadrugps( stdCompInfo);
				compService.anacomplprodcompareadrugmonps( stdCompInfo);
				compService.anacomplprodcompareaDel( stdCompInfo);
				compService.anacomplprodcompareamonps( stdCompInfo);
				compService.anacomplprodcompdrugps( stdCompInfo);
				compService.anacomplprodcompdrugmonps( stdCompInfo);
				compService.anacomplprodcompDel( stdCompInfo);
				compService.anacomplprodcompmonDel( stdCompInfo);
				compService.basedelrelationship( stdCompInfo);
				compService.anahospitalcompdrug( stdCompInfo);
				compService.anahospitalcompdrugmon( stdCompInfo);
				compService.anahospitalcomp( stdCompInfo);
				compService.anahospitalcompmon( stdCompInfo);
				compService.anaPurDateDel( stdCompInfo);
				compService.anaCompinfoMon( stdCompInfo);
				compService.anaCompinfoYear( stdCompInfo);
				compService.anaCompinfosea( stdCompInfo);
				compService.anaCompinfo( stdCompInfo);
				compService.anaDeldruginfoTotalMon( stdCompInfo);
				compService.anaDeldruginfoTotal( stdCompInfo);
				compService.anaDeldruginfoTotalYear( stdCompInfo);
				compService.anaDeldruginfoTotalSea( stdCompInfo);
				compService.anaCompdruginfoAreaMon( stdCompInfo);
				compService.anaCompdruginfoArea( stdCompInfo);
				compService.anaCompdruginfoAreYear( stdCompInfo); 
				compService.anaCompdruginfoAreaSea( stdCompInfo);
				compService.anaCompinfoAreaMon( stdCompInfo);
				compService.anaCompinfoArea( stdCompInfo);
				compService.anaCompinfoAreaYear( stdCompInfo);
				compService.anaCompinfoAreaSea( stdCompInfo);
				compService.baseShortage( stdCompInfo);*/
				//没找到的表
				/*compService.purreturnplan( stdCompInfo);
				compService.puraoginfo( stdCompInfo);*/
				//既要修改配送又要修改生产，现在属于修改配送，缺少修改生产
				/*compService.anacomplprodcompareadrug( stdCompInfo);
				compService.anacomplprodcompareadrugmon( stdCompInfo);
				compService.anacomplprodcomparea( stdCompInfo);
				compService.anacomplprodcompareamon(stdCompInfo);
				compService.anacomplprodcompdrug( stdCompInfo);
				compService.anacomplprodcompdrugmon( stdCompInfo);
				compService.anacomplprodcomp( stdCompInfo);
				compService.anacomplprodcompmon( stdCompInfo);*/
				//用户，商品，配送关系，配送企业地区
				compService.sysUser( stdCompInfo);
				compService.basedelrelationship( stdCompInfo);
				compService.baseDelAreaRel( stdCompInfo);
			}
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}
}